<!--
 * @Descripttion:
 * @version:
 * @Author: cxguo
 * @Date: 2020-06-15 10:41:02
 * @LastEditors: cxguo
 * @LastEditTime: 2020-06-15 11:26:46
-->
<template>
  <div class="app-container">
    <Tab
      ref="tab"
      :texts="['期初商品库存','期初应收欠款','期初应付欠款','期初账户余额']"
      :is-show-date="false"
    />
    <component :is="compName" />
  </div>
</template>

<script>
import Tab from '@/views/components/Tab'
import Stock from './stock.vue'
import DeptRece from './dept-rece.vue'
import DeptPay from './dept-pay.vue'
import Account from './account.vue'

export default {
  name: 'OriginInfo',
  components: { Tab, Stock, DeptRece, DeptPay, Account },
  data() {
    return {
      tabComp: null
    }
  },
  computed: {
    'currentIndex': function(params) {
      const tab = this.tabComp
      if (!tab) return 0
      return tab.currentIndex
    },
    'compName': function() {
      const currentIndex = this.currentIndex || 0
      const map = {
        0: 'Stock',
        1: 'DeptRece',
        2: 'DeptPay',
        3: 'Account'
      }
      return map[currentIndex]
    }
  },
  mounted() {
    this.tabComp = this.$refs.tab
  }
}
</script>

<style>

</style>
